<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: CSockAddr类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pro-attribs">Protected 属性</a> &#124;
<a href="class_c_sock_addr-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">CSockAddr类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>协议地址结构体  
 <a href="class_c_sock_addr.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="_sock_tools_8h_source.html">SockTools.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:ae3a48019cdfef4dcbaa2dacf6ff8b0ba"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#ae3a48019cdfef4dcbaa2dacf6ff8b0ba">CSockAddr</a> ()</td></tr>
<tr class="memdesc:ae3a48019cdfef4dcbaa2dacf6ff8b0ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造一个空地址结构  <a href="class_c_sock_addr.html#ae3a48019cdfef4dcbaa2dacf6ff8b0ba">更多...</a><br /></td></tr>
<tr class="separator:ae3a48019cdfef4dcbaa2dacf6ff8b0ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1fb46535b0d7d4e399fbd9a118da2e23"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a1fb46535b0d7d4e399fbd9a118da2e23">CSockAddr</a> (<a class="el" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a> domain, const char *addr, <a class="el" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> port)</td></tr>
<tr class="memdesc:a1fb46535b0d7d4e399fbd9a118da2e23"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造一个对应的地址结构信息  <a href="class_c_sock_addr.html#a1fb46535b0d7d4e399fbd9a118da2e23">更多...</a><br /></td></tr>
<tr class="separator:a1fb46535b0d7d4e399fbd9a118da2e23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a476be39967d335cf5068d15ddf6d04aa"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a476be39967d335cf5068d15ddf6d04aa">CSockAddr</a> (const <a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp;addr)</td></tr>
<tr class="separator:a476be39967d335cf5068d15ddf6d04aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5015a67491cc0cf9a6f6633285ada95d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a5015a67491cc0cf9a6f6633285ada95d">CSockAddr</a> (sockaddr *sockaddr, size_t size)</td></tr>
<tr class="memdesc:a5015a67491cc0cf9a6f6633285ada95d"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造一个对应的地址结构信息  <a href="class_c_sock_addr.html#a5015a67491cc0cf9a6f6633285ada95d">更多...</a><br /></td></tr>
<tr class="separator:a5015a67491cc0cf9a6f6633285ada95d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa1459d192d12a9a23eb4b69d7f8f3dfd"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#aa1459d192d12a9a23eb4b69d7f8f3dfd">~CSockAddr</a> ()</td></tr>
<tr class="separator:aa1459d192d12a9a23eb4b69d7f8f3dfd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbf36a7552925aad07123c90ff25a3a2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#acbf36a7552925aad07123c90ff25a3a2">operator=</a> (const <a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp;addr)</td></tr>
<tr class="separator:acbf36a7552925aad07123c90ff25a3a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ce83a4d05633aa56ea5c986adb4274e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a7ce83a4d05633aa56ea5c986adb4274e">Swap</a> (<a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp;addr)</td></tr>
<tr class="memdesc:a7ce83a4d05633aa56ea5c986adb4274e"><td class="mdescLeft">&#160;</td><td class="mdescRight">交换两个地址结构的值  <a href="class_c_sock_addr.html#a7ce83a4d05633aa56ea5c986adb4274e">更多...</a><br /></td></tr>
<tr class="separator:a7ce83a4d05633aa56ea5c986adb4274e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a47f353fb2149f02f507962dafd2bc6cc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a47f353fb2149f02f507962dafd2bc6cc">Clear</a> ()</td></tr>
<tr class="memdesc:a47f353fb2149f02f507962dafd2bc6cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">清空地址结构的值  <a href="class_c_sock_addr.html#a47f353fb2149f02f507962dafd2bc6cc">更多...</a><br /></td></tr>
<tr class="separator:a47f353fb2149f02f507962dafd2bc6cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae8ef048aa57a6915a360d731a3a844b0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#ae8ef048aa57a6915a360d731a3a844b0">SetSockAddr</a> (<a class="el" href="tools_8h.html#afdd49e476b36e84a9d6d171110e79940">SOCKADDR</a> *sockaddr, size_t size)</td></tr>
<tr class="memdesc:ae8ef048aa57a6915a360d731a3a844b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置地址结构的信息  <a href="class_c_sock_addr.html#ae8ef048aa57a6915a360d731a3a844b0">更多...</a><br /></td></tr>
<tr class="separator:ae8ef048aa57a6915a360d731a3a844b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab7aaac6f7f95bf879555e9391acdd3d6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#ab7aaac6f7f95bf879555e9391acdd3d6">SetDomain</a> (<a class="el" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a> domain)</td></tr>
<tr class="memdesc:ab7aaac6f7f95bf879555e9391acdd3d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置协议族  <a href="class_c_sock_addr.html#ab7aaac6f7f95bf879555e9391acdd3d6">更多...</a><br /></td></tr>
<tr class="separator:ab7aaac6f7f95bf879555e9391acdd3d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a489b625ee03b203ea32a5e859a51f04e"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a489b625ee03b203ea32a5e859a51f04e">SetAddr</a> (const char *addr)</td></tr>
<tr class="memdesc:a489b625ee03b203ea32a5e859a51f04e"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置地址  <a href="class_c_sock_addr.html#a489b625ee03b203ea32a5e859a51f04e">更多...</a><br /></td></tr>
<tr class="separator:a489b625ee03b203ea32a5e859a51f04e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a74baec009cf9d113674cbc5e9e3a76af"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a74baec009cf9d113674cbc5e9e3a76af">SetPort</a> (<a class="el" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> port)</td></tr>
<tr class="memdesc:a74baec009cf9d113674cbc5e9e3a76af"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置端口  <a href="class_c_sock_addr.html#a74baec009cf9d113674cbc5e9e3a76af">更多...</a><br /></td></tr>
<tr class="separator:a74baec009cf9d113674cbc5e9e3a76af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8470e1de788244f42de2389fff67136d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a8470e1de788244f42de2389fff67136d">GetDomain</a> () const</td></tr>
<tr class="memdesc:a8470e1de788244f42de2389fff67136d"><td class="mdescLeft">&#160;</td><td class="mdescRight">返回协议族  <a href="class_c_sock_addr.html#a8470e1de788244f42de2389fff67136d">更多...</a><br /></td></tr>
<tr class="separator:a8470e1de788244f42de2389fff67136d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0cb21021c083255163eeaa22ba08e24b"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a0cb21021c083255163eeaa22ba08e24b">GetAddr</a> (std::string &amp;addr) const</td></tr>
<tr class="memdesc:a0cb21021c083255163eeaa22ba08e24b"><td class="mdescLeft">&#160;</td><td class="mdescRight">返回字符串形式的ip地址  <a href="class_c_sock_addr.html#a0cb21021c083255163eeaa22ba08e24b">更多...</a><br /></td></tr>
<tr class="separator:a0cb21021c083255163eeaa22ba08e24b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adb9f91bd3797ee9ad416c755ab208cdf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#adb9f91bd3797ee9ad416c755ab208cdf">GetPort</a> () const</td></tr>
<tr class="memdesc:adb9f91bd3797ee9ad416c755ab208cdf"><td class="mdescLeft">&#160;</td><td class="mdescRight">返回端口  <a href="class_c_sock_addr.html#adb9f91bd3797ee9ad416c755ab208cdf">更多...</a><br /></td></tr>
<tr class="separator:adb9f91bd3797ee9ad416c755ab208cdf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e1b96bc3fec0a660e04466e66e97a4b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="tools_8h.html#afdd49e476b36e84a9d6d171110e79940">SOCKADDR</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a3e1b96bc3fec0a660e04466e66e97a4b">GetSockAddr</a> () const</td></tr>
<tr class="memdesc:a3e1b96bc3fec0a660e04466e66e97a4b"><td class="mdescLeft">&#160;</td><td class="mdescRight">返回原始地址结构指针  <a href="class_c_sock_addr.html#a3e1b96bc3fec0a660e04466e66e97a4b">更多...</a><br /></td></tr>
<tr class="separator:a3e1b96bc3fec0a660e04466e66e97a4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeecf85a21d35f8d2b7408700b3bca5df"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#aeecf85a21d35f8d2b7408700b3bca5df">GetSize</a> () const</td></tr>
<tr class="memdesc:aeecf85a21d35f8d2b7408700b3bca5df"><td class="mdescLeft">&#160;</td><td class="mdescRight">返回地址结构大小  <a href="class_c_sock_addr.html#aeecf85a21d35f8d2b7408700b3bca5df">更多...</a><br /></td></tr>
<tr class="separator:aeecf85a21d35f8d2b7408700b3bca5df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab038e13fc79cb146541e1242e17178bd"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#ab038e13fc79cb146541e1242e17178bd">GetSizeByDomain</a> () const</td></tr>
<tr class="memdesc:ab038e13fc79cb146541e1242e17178bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">根据domain返回结构体的大小  <a href="class_c_sock_addr.html#ab038e13fc79cb146541e1242e17178bd">更多...</a><br /></td></tr>
<tr class="separator:ab038e13fc79cb146541e1242e17178bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected 属性</h2></td></tr>
<tr class="memitem:a24246447eef2dad29eab779f8e2a5e75"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a24246447eef2dad29eab779f8e2a5e75">_addr</a></td></tr>
<tr class="separator:a24246447eef2dad29eab779f8e2a5e75"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ce3c1d797183bcffe8898ad77249c1e"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_sock_addr.html#a3ce3c1d797183bcffe8898ad77249c1e">_size</a></td></tr>
<tr class="separator:a3ce3c1d797183bcffe8898ad77249c1e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>协议地址结构体 </p>
<dl class="section remark"><dt>备注</dt><dd>目前兼容IPV6、IPV4、IPC IPV6=&gt;SOCKADDR_IN6 IPV4=&gt;SOCKADDR_IN IPC=&gt;sockaddr_un STORE=&gt;sockaddr_store </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8h_source.html">SockTools.h</a> 第 <a class="el" href="_sock_tools_8h_source.html#l00043">43</a> 行定义.</p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="ae3a48019cdfef4dcbaa2dacf6ff8b0ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae3a48019cdfef4dcbaa2dacf6ff8b0ba">&#9670;&nbsp;</a></span>CSockAddr() <span class="overload">[1/4]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CSockAddr::CSockAddr </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>构造一个空地址结构 </p>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00097">97</a> 行定义.</p>

</div>
</div>
<a id="a1fb46535b0d7d4e399fbd9a118da2e23"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1fb46535b0d7d4e399fbd9a118da2e23">&#9670;&nbsp;</a></span>CSockAddr() <span class="overload">[2/4]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CSockAddr::CSockAddr </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a>&#160;</td>
          <td class="paramname"><em>domain</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a>&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>构造一个对应的地址结构信息 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">domain</td><td>协议族 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>参见</dt><dd><a class="el" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a> </dd></dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>以字符串形式存在的ip地址格式数据 </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00102">102</a> 行定义.</p>

</div>
</div>
<a id="a476be39967d335cf5068d15ddf6d04aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a476be39967d335cf5068d15ddf6d04aa">&#9670;&nbsp;</a></span>CSockAddr() <span class="overload">[3/4]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CSockAddr::CSockAddr </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp;&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00127">127</a> 行定义.</p>

</div>
</div>
<a id="a5015a67491cc0cf9a6f6633285ada95d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5015a67491cc0cf9a6f6633285ada95d">&#9670;&nbsp;</a></span>CSockAddr() <span class="overload">[4/4]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CSockAddr::CSockAddr </td>
          <td>(</td>
          <td class="paramtype">sockaddr *&#160;</td>
          <td class="paramname"><em>sockaddr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>构造一个对应的地址结构信息 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">sockaddr</td><td>传入的地址结构体: </td></tr>
    <tr><td class="paramname">size</td><td>地址结构体大小 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section remark"><dt>备注</dt><dd>此函数不可设置SOCKADDR_STORE结构体 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00132">132</a> 行定义.</p>

</div>
</div>
<a id="aa1459d192d12a9a23eb4b69d7f8f3dfd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa1459d192d12a9a23eb4b69d7f8f3dfd">&#9670;&nbsp;</a></span>~CSockAddr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CSockAddr::~CSockAddr </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00137">137</a> 行定义.</p>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a47f353fb2149f02f507962dafd2bc6cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a47f353fb2149f02f507962dafd2bc6cc">&#9670;&nbsp;</a></span>Clear()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSockAddr::Clear </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>清空地址结构的值 </p>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00181">181</a> 行定义.</p>

</div>
</div>
<a id="a0cb21021c083255163eeaa22ba08e24b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0cb21021c083255163eeaa22ba08e24b">&#9670;&nbsp;</a></span>GetAddr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char * CSockAddr::GetAddr </td>
          <td>(</td>
          <td class="paramtype">std::string &amp;&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>返回字符串形式的ip地址 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">addr</td><td>接收地址参数 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回 addr.data()中的数据，注意不要使用addr接收该返回值 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00335">335</a> 行定义.</p>

</div>
</div>
<a id="a8470e1de788244f42de2389fff67136d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8470e1de788244f42de2389fff67136d">&#9670;&nbsp;</a></span>GetDomain()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a> CSockAddr::GetDomain </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>返回协议族 </p>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00322">322</a> 行定义.</p>

</div>
</div>
<a id="adb9f91bd3797ee9ad416c755ab208cdf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb9f91bd3797ee9ad416c755ab208cdf">&#9670;&nbsp;</a></span>GetPort()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> CSockAddr::GetPort </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>返回端口 </p>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00303">303</a> 行定义.</p>

</div>
</div>
<a id="aeecf85a21d35f8d2b7408700b3bca5df"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeecf85a21d35f8d2b7408700b3bca5df">&#9670;&nbsp;</a></span>GetSize()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t CSockAddr::GetSize </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>返回地址结构大小 </p>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00368">368</a> 行定义.</p>

</div>
</div>
<a id="ab038e13fc79cb146541e1242e17178bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab038e13fc79cb146541e1242e17178bd">&#9670;&nbsp;</a></span>GetSizeByDomain()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t CSockAddr::GetSizeByDomain </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>根据domain返回结构体的大小 </p>
<dl class="section return"><dt>返回</dt><dd>返回相应系统地址结构体的大小(sizeof(sockaddr_xxx))，失败返回0 </dd></dl>
<dl class="section remark"><dt>备注</dt><dd>sizeof(sockaddr_xxx) &gt; <a class="el" href="class_c_sock_addr.html#aeecf85a21d35f8d2b7408700b3bca5df" title="返回地址结构大小">GetSize()</a> 将返回0 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00373">373</a> 行定义.</p>

</div>
</div>
<a id="a3e1b96bc3fec0a660e04466e66e97a4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e1b96bc3fec0a660e04466e66e97a4b">&#9670;&nbsp;</a></span>GetSockAddr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="tools_8h.html#afdd49e476b36e84a9d6d171110e79940">SOCKADDR</a> * CSockAddr::GetSockAddr </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>返回原始地址结构指针 </p>
<dl class="section return"><dt>返回</dt><dd>返回原始地址结构指针 </dd></dl>
<dl class="section remark"><dt>备注</dt><dd>只支持sockaddr_in 和 sockaddr_in6 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00403">403</a> 行定义.</p>

</div>
</div>
<a id="acbf36a7552925aad07123c90ff25a3a2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acbf36a7552925aad07123c90ff25a3a2">&#9670;&nbsp;</a></span>operator=()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp; CSockAddr::operator= </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp;&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00144">144</a> 行定义.</p>

</div>
</div>
<a id="a489b625ee03b203ea32a5e859a51f04e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a489b625ee03b203ea32a5e859a51f04e">&#9670;&nbsp;</a></span>SetAddr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool CSockAddr::SetAddr </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置地址 </p>
<dl class="section return"><dt>返回</dt><dd>成功返回true,失败返回false </dd></dl>
<dl class="section remark"><dt>备注</dt><dd>只有通过setdomain函数或者构造函数设置过结构类型时才能成功 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00247">247</a> 行定义.</p>

</div>
</div>
<a id="ab7aaac6f7f95bf879555e9391acdd3d6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab7aaac6f7f95bf879555e9391acdd3d6">&#9670;&nbsp;</a></span>SetDomain()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSockAddr::SetDomain </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespace_s_o_c_k_f_a_m_i_l_y.html#a2752d06098f227dbd8340b30a718da81">SOCKFAMILY::SockFamily</a>&#160;</td>
          <td class="paramname"><em>domain</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置协议族 </p>
<dl class="section remark"><dt>备注</dt><dd>该操作会设定地址结构的类型和占用字节大小 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00209">209</a> 行定义.</p>

</div>
</div>
<a id="a74baec009cf9d113674cbc5e9e3a76af"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a74baec009cf9d113674cbc5e9e3a76af">&#9670;&nbsp;</a></span>SetPort()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool CSockAddr::SetPort </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a>&#160;</td>
          <td class="paramname"><em>port</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置端口 </p>
<dl class="section return"><dt>返回</dt><dd>成功返回true，失败返回false </dd></dl>
<dl class="section remark"><dt>备注</dt><dd>只有通过setdomain函数或者构造函数设置过结构类型时才能成功 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00278">278</a> 行定义.</p>

</div>
</div>
<a id="ae8ef048aa57a6915a360d731a3a844b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae8ef048aa57a6915a360d731a3a844b0">&#9670;&nbsp;</a></span>SetSockAddr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool CSockAddr::SetSockAddr </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="tools_8h.html#afdd49e476b36e84a9d6d171110e79940">SOCKADDR</a> *&#160;</td>
          <td class="paramname"><em>sockaddr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>设置地址结构的信息 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">sockaddr</td><td>地址结构信息 </td></tr>
    <tr><td class="paramname">size</td><td>地址结构大小 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section remark"><dt>备注</dt><dd>函数通过SOCKADDR::sa_family 获取到相应的地址结构大小sizeof(sockaddr_xxxx) 如果sizeof(sockaddr_xxxx) &gt; size 将会返回失败 </dd></dl>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00194">194</a> 行定义.</p>

</div>
</div>
<a id="a7ce83a4d05633aa56ea5c986adb4274e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7ce83a4d05633aa56ea5c986adb4274e">&#9670;&nbsp;</a></span>Swap()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSockAddr::Swap </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_c_sock_addr.html">CSockAddr</a> &amp;&#160;</td>
          <td class="paramname"><em>addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>交换两个地址结构的值 </p>

<p class="definition">在文件 <a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a> 第 <a class="el" href="_sock_tools_8cpp_source.html#l00188">188</a> 行定义.</p>

</div>
</div>
<h2 class="groupheader">类成员变量说明</h2>
<a id="a24246447eef2dad29eab779f8e2a5e75"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a24246447eef2dad29eab779f8e2a5e75">&#9670;&nbsp;</a></span>_addr</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">char* CSockAddr::_addr</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="_sock_tools_8h_source.html">SockTools.h</a> 第 <a class="el" href="_sock_tools_8h_source.html#l00137">137</a> 行定义.</p>

</div>
</div>
<a id="a3ce3c1d797183bcffe8898ad77249c1e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3ce3c1d797183bcffe8898ad77249c1e">&#9670;&nbsp;</a></span>_size</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t CSockAddr::_size</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="_sock_tools_8h_source.html">SockTools.h</a> 第 <a class="el" href="_sock_tools_8h_source.html#l00138">138</a> 行定义.</p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>H:/project/LibTools/src/socket/<a class="el" href="_sock_tools_8h_source.html">SockTools.h</a></li>
<li>H:/project/LibTools/src/socket/<a class="el" href="_sock_tools_8cpp_source.html">SockTools.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
